﻿
@{
    Layout = "~/Views/Shared/_Index.cshtml";
}

<style>
 
</style>
<form>
    <div class="panel panel-default">
        <div class="panel-heading navb-bg">
            筛选条件
        </div>
        <table class="form">
            <tr>
                <th class="formTitle">关键字：</th>
                <td class="formValue">
                    <input type="text" class="form-control form-an" id="xm" placeholder="姓名/拼音/病历号/证件号" />
                </td>
                @*<th class="formTitle">卡号：</th>
        <td class="formValue" width="120">
            <input type="text" class="form-control form-an" id="kh" />
        </td>*@
                <td class="formTitle">
                    <input type="button" id="btn_search" class="btn btn-md btn-primary form-an" value="查询" />

                </td>

                <th class="formTitle"></th>
                <td class="formValue"></td>
                <th class="formTitle"></th>
                <td class="formValue"></td>
            </tr>
        </table>
       
        <div class="panel-heading navb-bg">
            日志列表
        </div>
        <div class="gridPanel">
            <table id="gridList"></table>
            <div id="gridPager"></div>
        </div>
    </div>

</form>


<script>
    $(function () {
        pageInit();
    });
    function pageInit() {
        $("#gridList").dataGrid(
            {
                url: "/PatientManage/HospiterRes/GetModifyLog",
                postData: getSearchPostData(),
                colModel: [
                    { label: 'Id', name: 'Id', width: 100, align: 'left', hidden: true },
                    { label: 'patid', name: 'patid', width: 100, align: 'left', hidden: true },
                    { label: '姓名', name: 'xm', width: 100, align: 'left' },
                    {
                        label: '性别', name: 'xb', width: 70, align: 'left',
                        formatter: function (cellvalue) {
                            return $.getGender(cellvalue);
                        }
                    },
                    { label: '出生年月', name: 'csny', width: 100, align: 'left', formatter: "date", formatoptions: { srcformat: 'Y-m-d', newformat: 'Y-m-d' } },
                    { label: '病历号', name: 'blh', width: 100, align: 'left' },
                    { label: '联系电话', name: 'phone', width: 120, align: 'left' },
                    { label: '地址', name: 'xian_dz', width: 150, align: 'left' },
                    { label: '更新时间', name: 'CreateTime', width: 100, align: 'left', formatter: "date", formatoptions: { srcformat: 'Y-m-d H:i:s', newformat: 'Y-m-d H:i:s' } },
                ],
                rowNum: 15,
                rowList: [10, 20, 30],
                pager: '#gridPager',
                sortname: 'CreateTime desc',
                viewrecords: true,
                sortorder: "desc",
                height: $(window).height() - 175,
                ondblClickRow: function (rowid) {
                    XiangQin(rowid);
                },
            });
        
    }

    function XiangQin(rowData) {
        var rowData = $('#gridList').jqGrid('getRowData', rowData);
        $.modalOpen({
            id: "LogDetailsView",
            title: "日志详情",
            url: "/PatientManage/HospiterRes/LogDetailsView?Id=" + rowData.Id,
            width: "500px",
            height: "530px",
            callBack: function (iframeId) {
                top.frames[iframeId].$.modalClose();
            }
        });
        
    }
    $("#btn_search").click(function () {
        $("#gridList").jqGrid('setGridParam', {
            postData: getSearchPostData(),
            page: 1,
        }).trigger('reloadGrid');

    });
    //查询条件
    function getSearchPostData() {
        var xm = $("#xm").val();
        return { xm: xm };

    }
</script>
